package com.elinkway.infinitemovies.ui.fragment;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.elinkway.infinitemovies.bean.VideoDataBean;
import com.elinkway.infinitemovies.ui.activity.VideoDetailActivity;
import com.elinkway.infinitemovies.utils.LogUtils;
import com.le123.ysdq.R;

public class DetailSummaryFragment extends Fragment {

	private VideoDetailActivity masterActivity;

	@Override
	public void onAttach(Activity activity) {
		masterActivity = (VideoDetailActivity) activity;
		super.onAttach(activity);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		LogUtils.d("DetailFragment", "Summary onCreateView");
		View view = inflater.inflate(R.layout.vedio_detail_intro_new,
				container, false);
		TextView mIntro = (TextView) view.findViewById(R.id.vedio_detail_text);
		VideoDataBean video = masterActivity.getVideo();

		// TODO activity的异常重建一定几率会导致获取null
		if (video != null) {
			mIntro.setText(video.getDescription().equals("") ? video
					.getShortdesc() : video.getDescription());
		}
		return view;
	}

}
